<%@ page language="java" import="java.util.*,com.chart.*" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.io.PrintWriter,com.hangjiang.gulidear.model.Comment" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<c:set var="basePath" value="${pageContext.request.contextPath}" />


<html>
	<head>
		<title>客户评价统计</title>
		<meta http-equiv="content-Type" content="text/html;charset=UTF-8">
        <style>
			table{
				border:1px;
				font-size:12px;
				color:#333333;
			}
			table td{
				border:1px solid #999;/*细线表格线条颜色*/
				height:22px;
			}
			li{
				font-size: 14px;
				font-weight: bolder;
				height: 35px;
			}
			 body {
				background-image: url(../images/background_buttom.gif);
			}
		</style>

	</head>
	<body>
		<table align="center" width="50%">
			<tr align="left">
				<td colspan="4">
				
				
					<IMG src="${basePath }/tabs/images/home.gif">
				
				
				
					您的位置：客户评价&gt;&gt;评价统计
				</td>
			</tr>
		</table>
		<br />
		<table border="1" id="name" align="center" width="50%">
			<tr>
			<td colspan="2" width="403">
			
			  <%
			  
     BarChart bch = new BarChart();
			List<Comment> comments =(List<Comment>)  request.getAttribute("comments");
			int totalScoreAver = 0,qualityScoreAver = 0,sheduleScoreAver = 0, communicationScoreAver=0,num=0;
			 for(Comment item : comments){
                totalScoreAver += item.getTatalScore();
                qualityScoreAver += item.getQualityScore();
                sheduleScoreAver += item.getSheduleScore();
                communicationScoreAver += item.getCommunicationScore();
                num++;
			 }
   String projectName = (String)request.getAttribute("projectName");
   bch.setValue(totalScoreAver = totalScoreAver/num,"总体平均分",projectName);
   bch.setValue(sheduleScoreAver = sheduleScoreAver/num,"进度平均分",projectName);
   bch.setValue(qualityScoreAver = qualityScoreAver/num,"质量平均分",projectName);
   bch.setValue(communicationScoreAver = communicationScoreAver/num,"沟通平均分",projectName);

   String filename = bch.generateBarChart("客户评价统计", session,
     new PrintWriter(out),401,205);
   
   String url = request.getContextPath() + "/DisplayChart?filename="
     + filename;
  %>
			
				<img src="<%= url %>" width="401" height="205">
           </td>
			<td  colspan="2" valign="bottom">
            <ul style="width: 220">
            <p style="font-size: 15px;font-weight: bolder;">客户评分统计</p>
            <li>平均分：<font color="#FF0000"><%=totalScoreAver %></font></li>
			<li>平均进度评分：<font color="#FF0000"><%= sheduleScoreAver %> </font></li>
            <li>平均质量评分：<font color="#FF0000"><%= qualityScoreAver %></font></li>
			<li>平均沟通评分:<font color="#FF0000"><%= communicationScoreAver %></font></li>	
			</ul>
			</td>
			</tr>
			<tr>
				<td colspan="4">
					客户留言
				</td>
			</tr>
		
			<tr>
				<td colspan="4">
                	<table width="100%" border="1px" cellpadding="0" cellspacing="0">
                	 
                    	<tr>
                        
                            <td>客户名称</td>
                            <td>客户留言内容</td>
                        </tr>
                    	<tr>
                        	 <c:forEach items ="${comments}" var ="item">
                	 <tr>
                            <td>${item.user.userName }</td>
                            <td>${item.commentContent }</td>
                        </tr>
                	 </c:forEach>
                        
                    </table>
                </td>
			</tr>
			<tr>
				<td colspan="4"><input type="button" value="返回" class="type" style="width: 50px" />
				</td>

			</tr>
		</table>
	</body>
</html>
